package com.ruitu.mall_98_2.order;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.beanu.arad.Arad;
import com.beanu.arad.base.my_base.Config;
import com.beanu.arad.base.my_base.MyBaseActivity;
import com.beanu.arad.base.my_base.base_list.ListBaseAdapter;
import com.beanu.arad.base.my_base.base_list.SuperViewHolder;
import com.beanu.arad.utils.Logg;
import com.beanu.arad.widget.NoScrollViewPager;
import com.beanu.arad.widget.progressactivity.ProgressLayout;
import com.bumptech.glide.Glide;
import com.ruitu.mall_98_2.R;
import com.ruitu.mall_98_2.mvp.contract.OrderContract;
import com.ruitu.mall_98_2.mvp.model.OrderModel;
import com.ruitu.mall_98_2.mvp.presenter.OrderPresenter;
import com.ruitu.mall_98_2.order.fragment.AfterSalesPendingFragment;
import com.ruitu.mall_98_2.order.fragment.AllAfterSalesFragment;
import com.ruitu.router_module.A_Rutils;
import com.ruitu.router_module.AppHolder;
import com.ruitu.router_module.bean.api.PageModel;
import com.ruitu.router_module.bean.order.Order;
import com.ruitu.router_module.bean.order.SmallOrder;

import java.util.ArrayList;
import java.util.List;

public class AfterSalesOrderActivity extends MyBaseActivity {

    private List<Integer> skipId = new ArrayList<>();
    private TabLayout tabLayout;
    private NoScrollViewPager viewPager;
    private FragmentViewPagerAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initViews() {
        super.initViews();
        setHeadTitle("售后订单");
        tabLayout = findViewById(R.id.tabLayout);
        viewPager = findViewById(R.id.viewPager);
        adapter = new FragmentViewPagerAdapter(getSupportFragmentManager());
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);
        viewPager.setScanScroll(false);
    }

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_after_sales_order;
    }

    @Override
    protected ProgressLayout findProgressLayout() {
        return findViewById(R.id.progress);
    }

    class FragmentViewPagerAdapter extends FragmentPagerAdapter {

        public FragmentViewPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int position) {
            if (position == 1) {
                return AfterSalesPendingFragment.newInstance();
            }
            return AllAfterSalesFragment.newInstance();
        }

        @Override
        public int getCount() {
            return 2;
        }

        String title[] = {"全部", "待处理"};

        @Override
        public CharSequence getPageTitle(int position) {
            return title[position];
        }
    }

}
